package com.jinke.uang.model;

import com.jinke.uang.BuildConfig;
import com.jinke.uang.common.UserInfo;
import com.jinke.uang.constant.HttpConstant;
import com.jinke.uang.http.ModelUtils;
import com.jinke.uang.http.ParamsFactory;
import com.jinke.uang.http.RetrofitManager;
import com.jinke.uang.interfaces.ICommonModule;
import com.jinke.uang.interfaces.ICommonView;

import java.util.HashMap;
import java.util.Map;

/**
 * 作者：Song Shuyu
 * 时间：2019/4/22 15:03
 * package is com.jinke.uang.model
 */
public class MainModule implements ICommonModule {
    @Override
    public void getData(ICommonView view, int apiType, String listType, Object[] t) {
        Map<String, Object> hashMap = new HashMap<>();
        switch (apiType) {
            case HttpConstant.GET_PRODUCT: //产品等级
                ModelUtils.ModelUtils(RetrofitManager.getInstance().getINetService().getProduct
                        (BuildConfig.channel, UserInfo.getToken(), ParamsFactory.getCommonParams(null)), view, apiType, listType,t);
                break;

            case HttpConstant.NOTICE_CHANNEL: //公告轮播
//                ModelUtils.ModelUtils(RetrofitManager.getInstance().getINetService().getNotice
//                        (BuildConfig.channel, UserInfo.getToken(), ParamsFactory.getCommonParams(null)), view, apiType, listType,t);
                break;
            case HttpConstant.GOOGLE_PLAY_UPDATE_INFO:
                ModelUtils.ModelUtils(RetrofitManager.getInstance().getINetService().getGooglePlayUpdateInfo
                        (BuildConfig.channel, UserInfo.getToken(), ParamsFactory.getCommonParams(null)), view, apiType, listType,t);
                break;

            case HttpConstant.ORDER_DATA: //根据多个订单类型获取数据
                hashMap.clear();
                hashMap.put("type",String.valueOf(t[0]));
                ModelUtils.ModelUtils(RetrofitManager.getInstance().getINetService().getOrderData(BuildConfig.channel, UserInfo.getToken(),
                        ParamsFactory.getCommonParams(hashMap)), view, apiType, listType,t);
                break;
            default:
                break;
        }
    }
}
